<%@page import="java.text.SimpleDateFormat"%>
<%@ page language="java" contentType="text/html; charset=utf-8"%>
<%@ taglib uri="/struts-tags" prefix="s" %>
<%@ taglib uri="/struts-dojo-tags" prefix="sx"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%
	java.util.Date currTime = new java.util.Date();
	SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
	String strTime = sdf.format(currTime);
%>

<html>
	<head>
<!---手机跳转判断开始--->
<script language="javascript">
	function firm(){
		var st = document.getElementById("status");
		if(st.value=="修改"){
		if(confirm("确定修改消费吗?")){
			event.returnValue=true;
		}else{
			event.returnValue=false;
		}
		}
	}
	(function() {
		var res = GetRequest();
		var par = res['index'];
		if (par != 'gfan') {
			var ua = navigator.userAgent.toLowerCase();
			var contains = function(a, b) {
				if (a.indexOf(b) != -1) {
					return true;
				}
			};

			var toMobileVertion = function() {
				window.location.href = 'wapnewcost.jsp';
			};

			if (contains(ua, "ipad") || (contains(ua, "rv:1.2.3.4"))
					|| (contains(ua, "0.0.0.0"))
					|| (contains(ua, "8.0.552.237"))) {
				return false;
			}
			if ((contains(ua, "android") && contains(ua, "mobile"))
					|| (contains(ua, "android") && contains(ua, "mozilla"))
					|| (contains(ua, "android") && contains(ua, "opera"))
					|| contains(ua, "ucweb") || contains(ua, "iphone")) {
				toMobileVertion();
			}
		}
	})();
	function GetRequest() {
		var url = location.search; //获取url中"?"符后的字串
		var theRequest = new Object();
		if (url.indexOf("?") != -1) {
			var str = url.substr(1);
			strs = str.split("&");
			for ( var i = 0; i < strs.length; i++) {
				theRequest[strs[i].split("=")[0]] = unescape(strs[i].split("=")[1]);
			}
		}
		return theRequest;
	}
</script>
		<title>消费页面</title>
		<script type="text/javascript"> 
			function IsNum(obj){
			var val = obj.value;
			obj.value = (parseInt(val) || '');
			//obj.value = one != '0'? (parseInt(val) || '') : one + (parseInt(val.substr(1,val.length)) || '');
			}
		</script>
		
		<link rel="stylesheet" type="text/css" href='<s:url value="/styles.css" />'>
		<sx:head/>
	</head>
	<body>
		<s:include value="header.jsp" />
		<s:if test="#session['user'] != null">
			<div class="divNavigatorOuterFrame">
				<div class="divNavigatorInnerFrame" style="text-align: right;">
					欢迎<s:property value="#session['user'].name" />&nbsp;&nbsp;
				</div>
			</div>
			<div class="divWhiteLine"></div>
		</s:if>
		<s:hidden name="status"/>
		<s:form action="DaycostAction_newDaycost.action" theme="simple" method="post">
		<table>
			<tr>
				<td colspan="4" class="tdHeader"><s:if test="status == null">添加</s:if ><s:else><s:label name="status"/></s:else>消费</td>
				<s:hidden name="daycost.id"/>
			</tr>
			<tr>
				<sx:datetimepicker name="daycost.costtime" label="消费时间" displayFormat="yyyy-MM-dd" toggleType="explode" language="zh-cn"></sx:datetimepicker>
			</tr>
			<tr>
				<td class="tdFormLabel">早餐(元):</td>
				<td class="tdFormControl">
					<s:textfield name="daycost.breakfast" cssClass="text" onkeyup="javascript:IsNum(this)" />
					<font class="fonterror"><s:fielderror><s:param>breakfast</s:param></s:fielderror></font>
				</td>
				<td class="tdFormLabel">午餐(元):</td>
				<td class="tdFormControl">
					<s:textfield name="daycost.lunch" cssClass="text" onkeyup="javascript:IsNum(this)"/>
					<font class="fonterror"><s:fielderror><s:param>lunch</s:param></s:fielderror></font>
				</td>
			</tr>
			<tr>
				<td class="tdFormLabel">晚餐(元):</td>
				<td class="tdFormControl">
					<s:textfield name="daycost.dinner" cssClass="text" onkeyup="javascript:IsNum(this)"/>
					<font class="fonterror"><s:fielderror><s:param>dinner</s:param></s:fielderror></font>
				</td>
				<td class="tdFormLabel">宵夜(元):</td>
				<td class="tdFormControl">
					<s:textfield name="daycost.supper" cssClass="text" onkeyup="javascript:IsNum(this)"/>
					<font class="fonterror"><s:fielderror><s:param>supper</s:param></s:fielderror></font>
				</td>
			</tr>
			<tr>
				<td class="tdFormLabel">看病(元):</td>
				<td class="tdFormControl">
					<s:textfield name="daycost.ill" cssClass="text" onkeyup="javascript:IsNum(this)"/>
					<font class="fonterror"><s:fielderror><s:param>ill</s:param></s:fielderror></font>
				</td>
				<td class="tdFormLabel">学习用品(元):</td>
				<td class="tdFormControl">
					<s:textfield name="daycost.schoolsupplies" cssClass="text" onkeyup="javascript:IsNum(this)"/>
					<font class="fonterror"><s:fielderror><s:param>schoolsupplies</s:param></s:fielderror></font>
				</td>
			</tr>
			<tr>
				<td class="tdFormLabel">生活用品(元):</td>
				<td class="tdFormControl">
					<s:textfield name="daycost.articleuse" cssClass="text" onkeyup="javascript:IsNum(this)"/>
					<font class="fonterror"><s:fielderror><s:param>articleuse</s:param></s:fielderror></font>
				</td>
				<td class="tdFormLabel">公汽(元):</td>
				<td class="tdFormControl">
					<s:textfield name="daycost.bus" cssClass="text" onkeyup="javascript:IsNum(this)"/>
					<font class="fonterror"><s:fielderror><s:param>bus</s:param></s:fielderror></font>
				</td>
			</tr>
			<tr>
				<td class="tdFormLabel">的士费(元):</td>
				<td class="tdFormControl">
					<s:textfield name="daycost.texi" cssClass="text" onkeyup="javascript:IsNum(this)"/>
					<font class="fonterror"><s:fielderror><s:param>texi</s:param></s:fielderror></font>
				</td>
				<td class="tdFormLabel">长途汽车费(元):</td>
				<td class="tdFormControl">
					<s:textfield name="daycost.coach" cssClass="text" onkeyup="javascript:IsNum(this)"/>
					<font class="fonterror"><s:fielderror><s:param>coach</s:param></s:fielderror></font>
				</td>
			</tr>
			<tr>
				<td class="tdFormLabel">火车费(元):</td>
				<td class="tdFormControl">
					<s:textfield name="daycost.train" cssClass="text" onkeyup="javascript:IsNum(this)"/>
					<font class="fonterror"><s:fielderror><s:param>train</s:param></s:fielderror></font>
				</td>
				<td class="tdFormLabel">订票费(元):</td>
				<td class="tdFormControl">
					<s:textfield name="daycost.booking" cssClass="text" onkeyup="javascript:IsNum(this)"/>
					<font class="fonterror"><s:fielderror><s:param>booking</s:param></s:fielderror></font>
				</td>
			</tr>
			<tr>
				<td class="tdFormLabel">船票费(元):</td>
				<td class="tdFormControl">
					<s:textfield name="daycost.ship" cssClass="text" onkeyup="javascript:IsNum(this)"/>
					<font class="fonterror"><s:fielderror><s:param>ship</s:param></s:fielderror></font>
				</td>
				<td class="tdFormLabel">机票费(元):</td>
				<td class="tdFormControl">
					<s:textfield name="daycost.airplane" cssClass="text" onkeyup="javascript:IsNum(this)"/>
					<font class="fonterror"><s:fielderror><s:param>airplane</s:param></s:fielderror></font>
				</td>
			</tr>
			<tr>
				<td class="tdFormLabel">住宿费(元):</td>
				<td class="tdFormControl">
					<s:textfield name="daycost.hotel" cssClass="text" onkeyup="javascript:IsNum(this)"/>
					<font class="fonterror"><s:fielderror><s:param>hotel</s:param></s:fielderror></font>
				</td>
				<td class="tdFormLabel">礼品费(元):</td>
				<td class="tdFormControl">
					<s:textfield name="daycost.gift" cssClass="text" onkeyup="javascript:IsNum(this)"/>
					<font class="fonterror"><s:fielderror><s:param>gift</s:param></s:fielderror></font>
				</td>
			</tr>
			<tr>
				<td class="tdFormLabel">房租(元):</td>
				<td class="tdFormControl">
					<s:textfield name="daycost.rent" cssClass="text" onkeyup="javascript:IsNum(this)"/>
					<font class="fonterror"><s:fielderror><s:param>rent</s:param></s:fielderror></font>
				</td>
				<td class="tdFormLabel">水电费(元):</td>
				<td class="tdFormControl">
					<s:textfield name="daycost.waterelectricity" cssClass="text" onkeyup="javascript:IsNum(this)"/>
					<font class="fonterror"><s:fielderror><s:param>waterelectricity</s:param></s:fielderror></font>
				</td>
			</tr>
			<tr>
				<td class="tdFormLabel">宽带费(元):</td>
				<td class="tdFormControl">
					<s:textfield name="daycost.broadband" cssClass="text" onkeyup="javascript:IsNum(this)"/>
					<font class="fonterror"><s:fielderror><s:param>broadband</s:param></s:fielderror></font>
				</td>
				<td class="tdFormLabel">电话费(元):</td>
				<td class="tdFormControl">
					<s:textfield name="daycost.phone" cssClass="text" onkeyup="javascript:IsNum(this)"/>
					<font class="fonterror"><s:fielderror><s:param>phone</s:param></s:fielderror></font>
				</td>
			</tr>
			<tr>
				<td class="tdFormLabel">还贷款/还钱(元):</td>
				<td class="tdFormControl">
					<s:textfield name="daycost.payback" cssClass="text" onkeyup="javascript:IsNum(this)"/>
					<font class="fonterror"><s:fielderror><s:param>payback</s:param></s:fielderror></font>
				</td>
				<td class="tdFormLabel">其它费用(元):</td>
				<td class="tdFormControl">
					<s:textfield name="daycost.others" cssClass="text" onkeyup="javascript:IsNum(this)"/>
					<font class="fonterror"><s:fielderror><s:param>others</s:param></s:fielderror></font>
				</td>
			</tr>
			<tr>
				<td class="tdFormLabel">备注:</td>
				<td class="tdFormControl">
					<s:textarea colspan="1" name="daycost.comments" cssClass="text" />
					<font class="fonterror"><s:fielderror><s:param>comments</s:param></s:fielderror></font>
				</td>
			</tr>
			<tr>
				<td colspan="4"></td>
			</tr>
			</table>
			<table align="right">
			<tr>				
				<td><s:submit cssClass="btn" value="确定" onclick="firm()"/></td>
			</tr>
		</table>
		</s:form>
	</body>
</html>